# my domain id.
if not dominfo:
return
- print 'check_name>', 'dom=', dominfo.name, dominfo.dom, 'self=', name, self.dom
+ #print 'check_name>', 'dom=', dominfo.name, dominfo.dom, 'self=', name, self.dom
if dominfo.is_terminated():
return
if not self.dom or (dominfo.dom != self.dom):
def configure(self):
"""Configure a vm.
- vm virtual machine
- config configuration
-
- returns Deferred - calls callback with vm
+ @return: deferred - calls callback with vm
"""
- d = self.create_devices()
+ d = self.create_blkif()
+ d.addCallback(lambda x: self.create_devices())
d.addCallback(self._configure)
return d
d.addErrback(cberr)
return d
+ def create_blkif(self):
+ """Create the block device interface (blkif) for the vm.
+ The vm needs a blkif even if it doesn't have any disks
+ at creation time, for example when it uses NFS root.
+
+ @return: deferred
+ """
+ ctrl = xend.blkif_create(self.dom, recreate=self.recreate)
+ back = ctrl.getBackend(0)
+ return back.connect(recreate=self.recreate)
+
def dom_construct(self, dom, config):
"""Construct a vm for an existing domain.
- @param dom: domain id
+ @param dom: domain id
+ @param config: domain configuration
@return: deferred
"""
d = dom_get(dom)
if not d:
raise VmError("Domain not found: %d" % dom)
- print 'dom_construct>', dom, config
try:
self.restore = 1
self.setdom(dom)
class BlkifBackendController(controller.BackendController):
""" Handler for the 'back-end' channel to a device driver domain.
+ Must be connected using connect() before it can be used.
+ Do not create directly - use getBackend() on the BlkifController.
"""
def __init__(self, ctrl, dom, handle):
def __init__(self, factory, dom):
"""Create a block device controller.
- The controller must be connected using connect() before it can be used.
Do not call directly - use createInstance() on the factory instead.
"""
controller.SplitController.__init__(self, factory, dom)